package service;

import dao.ProductDao;
import dao.ProductImpl;
import domain.Product;

import java.sql.SQLException;
import java.util.List;

/**
 * Created by guo on 2017/10/23.
 */
public class ProductServiceImpl implements ProductService{
    @Override
    public List<Product> findAll() {
        ProductDao pd=new ProductImpl();
        return pd.findAll();
    }

    @Override
    public Boolean Add(String pname, Double market_price, Double shop_price, String pdesc) throws SQLException {
        ProductDao productDao=new ProductImpl();
        return productDao.Add(pname,market_price,shop_price,pdesc);
    }

    @Override
    public Boolean Delete(int pid) throws SQLException {
        ProductDao pd=new ProductImpl();
        return pd.Delete(pid);
    }

    @Override
    public Boolean Update(String pname, Double market_price, Double shop_price, String pdesc,int pid) throws SQLException {
        ProductDao productDao=new ProductImpl();
        return productDao.Update(pname,market_price,shop_price,pdesc,pid);
    }

}
